home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD (UK) 1998 May / PCPlus May 1998=disk A.iso / trial / gdldb / disk1 / data1.cab / Example_Files / foodstore.scp < prev    next >
Encoding:
Text File  |  1998-01-21  |  3.5 KB  |  147 lines

  1. ##########################################################
  2. # GDIdB demo script (c) 1997 Global Data Industries
  3. # Datasource=foodstore.xls (Excel spreadsheet)
  4. #
  5. # In this basic example, the contents of the spreadsheet
  6. # is merged with the site html using html table tags, producing
  7. # a table similar to the spreadsheet itself.
  8. ##########################################################
  9.  
  10.  
  11.  
  12.  
  13.  
  14. ##########################################################
  15. # declare variables used by script
  16. &defvar(?name?,?test?)
  17.  
  18.  
  19.  
  20.  
  21.  
  22. ##########################################################
  23. # Print the information screen
  24.  
  25. &cls
  26. &print("Foodstore Demo Script")
  27. &print("---------------------------------")
  28.  
  29.  
  30.  
  31.  
  32.  
  33. ##########################################################
  34. # get the name of the person running the script
  35.  
  36. &input(?name?,"Please enter your name")
  37.  
  38.  
  39.  
  40.  
  41.  
  42. ##########################################################
  43. # Declare the ODBC datasource
  44.  
  45. &datasource("Driver={Microsoft Excel Driver (*.xls)};DBQ=foodstore.xls")
  46.  
  47.  
  48.  
  49.  
  50.  
  51. ##########################################################
  52. # generate html
  53.  
  54. &print("Generating HTML...")
  55. &html("index.html")
  56. {
  57.     <HTML>
  58.     <HEAD>
  59.     <TITLE>The Essential Programmer's Online Foodstore</TITLE>
  60.     </HEAD>
  61.     <BODY BACKGROUND="burger.gif">
  62.     <IMG SRC="fries.gif" ALIGN=LEFT>
  63.     <IMG SRC="fries.gif" ALIGN=RIGHT>
  64.     <CENTER>
  65.     <BR><BR>
  66.     <FONT COLOR="\#B48424">
  67.     <H1>The Essential Programmer's<BR> 
  68.     Online Foodstore</H1>
  69.     </FONT>
  70.     <BR CLEAR=LEFT> 
  71.     <TABLE BORDER=0 WIDTH=80%>
  72.     <TR><TD><FONT FACE="Arial,Helvetica">
  73.     <P>Here at <B>The Essential Programmer's Online Foodstore,</B>
  74.     we <I>know</I> a serious coding session requires <I>full and professional</I>
  75.     support. That's why we've given you that support. Where you want it. Online.
  76.     When you want it. 24 Hours a day. Every day. (Unless we're at the beach)
  77.     <P>The Essential Programmer's Online Foodstore. More than just a luxury, we
  78.     <I>DARE</I> you to try programming without our URL in your bookmarks!
  79.     <BR><BR><BR>
  80.     <FONT COLOR=RED SIZE=+1>Site updated 
  81.  
  82.     # only include user's name if they actually bothered to enter it!
  83.     &strcmp(?test?,"",ne,"?name?")
  84.     &if(?test?)
  85.     {
  86.         by ?name?
  87.     }
  88.  
  89.     at ?gdidbtime? on ?gdidbdate.dn? ?gdidbdate?.</FONT>
  90.  
  91.     </FONT>
  92.     </TD></TR>
  93.     </TABLE>
  94.     </CENTER>
  95.     <BR><BR><BR>
  96.     <CENTER>
  97.     <IMG SRC="donut.gif"><IMG SRC="donut.gif"><IMG SRC="donut.gif"><IMG SRC="donut.gif"><IMG SRC="donut.gif"><IMG SRC="donut.gif"><IMG SRC="donut.gif">
  98.     </CENTER>
  99.     <FONT SIZE=+3>Price list:</FONT><BR>
  100.     <TABLE WIDTH="100%">
  101.     <TR>
  102.     <TD><FONT SIZE=+2>Item</FONT></TD>
  103.     <TD><FONT SIZE=+2>Stock</FONT></TD>
  104.     <TD><FONT SIZE=+2>Cost</FONT></TD>
  105.     <TD><FONT SIZE=+2>Per</FONT></TD> 
  106.     <TD><FONT SIZE=+2>VAT</FONT></TD>
  107.     <TD><FONT SIZE=+2>Delivery</FONT></TD>
  108.     <TD><FONT SIZE=+2>Total</FONT></TD>
  109.     </TR>
  110.  
  111.     # loop through each row of the dataset, turning the spreadsheet
  112.     # table into a HTML table
  113.  
  114.     &getdata("SELECT * FROM sheet")
  115.     {
  116.         <TR>
  117.         <TD>?Item?</TD>
  118.         <TD>?Stock?</TD> 
  119.         <TD>ú?Cost?</TD>
  120.         <TD>?Per?</TD>
  121.         <TD>ú?VAT?</TD>
  122.         <TD>ú?Delivery?</TD>
  123.         <TD>ú?Total?</TD>
  124.         </TR>
  125.     }
  126.     </TABLE>
  127.     <CENTER>
  128.     <IMG SRC="donut.gif"><IMG SRC="donut.gif"><IMG SRC="donut.gif"><IMG SRC="donut.gif"><IMG SRC="donut.gif"><IMG SRC="donut.gif"><IMG SRC="donut.gif">
  129.     </CENTER>
  130.     </BODY>
  131.     </HTML>
  132. }
  133.  
  134.  
  135.  
  136.  
  137.  
  138. ##########################################################
  139. # print closing information
  140.  
  141. &cls
  142. &print("Demo web site HTML generation complete! Click the HTML button to see the results.")
  143. &print
  144. &print
  145.  
  146. # END OF SCRIPT
  147.